package StudyCode.summary.mycollection;

import java.util.HashSet;
import java.util.Iterator;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class IntersectionSet {
	public static HashSet<String> intersectionSet(HashSet<String> setA,
	                                              HashSet<String> setB) {
		HashSet<String> intersectionSet = new HashSet<String>();
		Iterator<String> iterA = setA.iterator();
		while (iterA.hasNext()) {
			String tempInner = iterA.next();
			if (setB.contains(tempInner)) {
				intersectionSet.add(tempInner);
			}
		}
		return intersectionSet;
	}
}
